<?php

class Agilet_Layout{
	
	private $_layout;
	
	private $_space;
	
	/**
	 * @return string
	 */
	public function getLayout(){
		if($this->_layout == NULL){
			$this->_layout = 'index';
		}
		return $this->_layout;
	}
	
	/**
	 * @return string
	 */
	public function getSpace(){
		if($this->_space == NULL){
			$this->_space =  Agilet::getInst()->getSpace();
		}
		return $this->_space;
	}
	
	/**
	 * @param  string
	 * @return Agilet_Layout
	 */
	public function setLayout($layout){
		$this->_layout =  $layout;
		return $this;
	}
	
	public function getFullPath(){
		return APP_PATH .  '/layouts/' . $this->getSpace(). '/' . $this->getLayout() .'.phtml';
	}
	
	
	public function render(){
		$filename = $this->getFullPath();
		$view = Zend_Registry::get('Zend_View');
		$view->direct($filename );
	}

}
